<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<h1>修改页面</h1>
<div>
  <input type="text" v-model="person.id" placeholder="id" readonly>
  <input type="text" v-model="person.name" placeholder="姓名">
  <input type="text" v-model="person.title" placeholder="称号">
  <input type="text" v-model="person.wks" placeholder="名言">
  <input type="text" v-model="person.world" placeholder="所属世界">
  <input type="button" value="修改" @click="update()">
</div>
<script src="js/vue.js"></script>
<script src="js/axios.min.js"></script>
<script>
  let v = new Vue({
    el:"div",
    data:{
      person:{}
    },
    created:function () {
      let id = location.search.split("=")[1];
      axios.get("/selectById?id="+id).then(function (response) {
        v.person=response.data;
      })
    },
    methods:{
      update(){
        axios.post("/update",v.person).then(function (response) {
          alert("修改成功！");
          location.href="list.html";
        })
      }
    }
  })
</script>
</body>
</html>